<template>
    <div v-if="list" class="nav-container">
      <div v-for="(item,index) in list" :key="index" class="nav-item">
        <span @click="handleClick(item)" :class="{active:item.isSelect}">{{item.name}}</span>
        <span v-if="item.aside" class="aside" :class="{active:item.isSelect}">{{item.aside}}</span>
      <index :list="item.children" @select="handleClick"></index>
      </div>
    </div>
</template>

<script>
export default {
  name: 'index',
  props: {
    // [{value:'xx', isSelect:true, nums:12, children:[{value:'xxx',isSelect:true}]}]
    list: {
      type: Array,
      default: () => []
    }
  },
  methods: {
    handleClick (item) {
      this.$emit('select', item)
    }
  }
}
</script>

<style lang="less" scoped>
  @import '~@/styles/var';
.nav-container{
  padding: 0;
  .nav-container{
    margin-left: 1em;
  }
  .nav-item{
    min-height: 40px;
    line-height: 40px;
    cursor: pointer;
    .aside{
      font-size: 12px;
      margin-left: 1em;
      color: @gray;
    }
    .active{
      color: @warn;
      font-weight: bold;
    }
  }
}
</style>
